#include <cstdio>

int main( )
{
    int a[ 11 ][ 11 ], i, j, n, t;
    while ( scanf("%d", &n) != EOF )
    {
        if ( n == 1 )
        {
            printf("%3d\n", 1);
            continue;
        }
        for ( i = 0; i < n; i++ )
            for ( j = 0; j < n; j++ )
                a[ i ][ j ] = 0;
        t = 1;
        for ( i = 0; i < n - 1; i++ )
            a[ 0 ][ i ] = t++;
        for ( i = 0; i < n - 1; i++ )
            a[ i ][ n - 1 ] = t++;
        for ( i = 0; i < n - 1; i++ )
            a[ n - 1 ][ n - i - 1 ] = t++;
        for ( i = 0; i < n - 1; i++ )
            a[ n - i - 1 ][ 0 ] = t++;
        for ( i = 0; i < n; i++ )
        {
            for ( j = 0; j < n; j++ )
                if ( a[ i ][ j ] )
                    printf("%3d", a[ i ][ j ]);
                else
                    printf("   ");
            printf("\n");
        }
    }
    return 0;
}
